{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential_4\"\n",
      "_________________________________________________________________\n",
      " Layer (type)                Output Shape              Param #   \n",
      "=================================================================\n",
      " dense_23 (Dense)            (None, 200)               2600      \n",
      "                                                                 \n",
      " dense_24 (Dense)            (None, 200)               40200     \n",
      "                                                                 \n",
      " dense_25 (Dense)            (None, 40)                8040      \n",
      "                                                                 \n",
      " dense_26 (Dense)            (None, 200)               8200      \n",
      "                                                                 \n",
      " dense_27 (Dense)            (None, 200)               40200     \n",
      "                                                                 \n",
      " dense_28 (Dense)            (None, 3)                 603       \n",
      "                                                                 \n",
      "=================================================================\n",
      "Total params: 99,843\n",
      "Trainable params: 99,843\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "from tensorflow import keras\n",
    "from keras.models import Sequential\n",
    "from keras.layers.core import Dense\n",
    "\n",
    "model = Sequential()\n",
    "model.add(Dense(200, activation='relu', input_dim=12))\n",
    "model.add(Dense(200, activation=None))\n",
    "model.add(Dense(40, activation=None))\n",
    "model.add(Dense(200, activation='relu'))\n",
    "model.add(Dense(200, activation='relu'))\n",
    "model.add(Dense(3, activation='sigmoid'))\n",
    "model.compile(loss='categorical_crossentropy',\n",
    "              optimizer='rmsprop',\n",
    "              metrics=['accuracy'])\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.07314064 0.0590404  0.08535374 ... 0.91001684 0.5576565  0.97261429]\n",
      " [0.21248898 0.87106991 0.13816639 ... 0.26763361 0.0801604  0.68428234]\n",
      " [0.15289663 0.18826052 0.0869926  ... 0.53577956 0.1285485  0.87976559]\n",
      " ...\n",
      " [0.11355346 0.52815302 0.75499658 ... 0.7681974  0.36772752 0.27244555]\n",
      " [0.78935942 0.49809412 0.464129   ... 0.48966759 0.84659466 0.26607029]\n",
      " [0.49426494 0.18897022 0.01156733 ... 0.99800848 0.15351664 0.07410897]]\n",
      "[[0 0 0]\n",
      " [0 0 1]\n",
      " [0 0 0]\n",
      " ...\n",
      " [1 1 0]\n",
      " [0 1 1]\n",
      " [0 0 0]]\n",
      "Epoch 1/60\n",
      "16/16 [==============================] - 1s 2ms/step - loss: 4.8031 - accuracy: 0.3050\n",
      "Epoch 2/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 64.2894 - accuracy: 0.2940\n",
      "Epoch 3/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 305.1780 - accuracy: 0.3310\n",
      "Epoch 4/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 885.2088 - accuracy: 0.3310\n",
      "Epoch 5/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 1891.2372 - accuracy: 0.3310\n",
      "Epoch 6/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 4164.8794 - accuracy: 0.3370\n",
      "Epoch 7/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 7314.7222 - accuracy: 0.3480\n",
      "Epoch 8/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 12064.6865 - accuracy: 0.2990\n",
      "Epoch 9/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 20192.7793 - accuracy: 0.3250\n",
      "Epoch 10/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 29183.9785 - accuracy: 0.3050\n",
      "Epoch 11/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 42448.6211 - accuracy: 0.3060\n",
      "Epoch 12/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 63161.1484 - accuracy: 0.3570\n",
      "Epoch 13/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 88125.8438 - accuracy: 0.3200\n",
      "Epoch 14/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 117301.0391 - accuracy: 0.3300\n",
      "Epoch 15/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 163573.4219 - accuracy: 0.3010\n",
      "Epoch 16/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 208829.2812 - accuracy: 0.3180\n",
      "Epoch 17/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 259589.6406 - accuracy: 0.3330\n",
      "Epoch 18/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 357199.7500 - accuracy: 0.3190\n",
      "Epoch 19/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 404946.6562 - accuracy: 0.3470\n",
      "Epoch 20/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 557818.8125 - accuracy: 0.3150\n",
      "Epoch 21/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 660950.7500 - accuracy: 0.3230\n",
      "Epoch 22/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 850272.9375 - accuracy: 0.3370\n",
      "Epoch 23/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 1000327.1875 - accuracy: 0.3360\n",
      "Epoch 24/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 1245644.7500 - accuracy: 0.3140\n",
      "Epoch 25/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 1479589.2500 - accuracy: 0.3160\n",
      "Epoch 26/60\n",
      "16/16 [==============================] - 0s 3ms/step - loss: 1628044.8750 - accuracy: 0.3580\n",
      "Epoch 27/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 2066281.2500 - accuracy: 0.3380\n",
      "Epoch 28/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 2417567.7500 - accuracy: 0.3200\n",
      "Epoch 29/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 3046500.7500 - accuracy: 0.3540\n",
      "Epoch 30/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 3070464.7500 - accuracy: 0.3530\n",
      "Epoch 31/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 3827842.0000 - accuracy: 0.3400\n",
      "Epoch 32/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 4491939.0000 - accuracy: 0.3350\n",
      "Epoch 33/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 5449116.5000 - accuracy: 0.3050\n",
      "Epoch 34/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 5876915.0000 - accuracy: 0.3640\n",
      "Epoch 35/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 6607819.0000 - accuracy: 0.3360\n",
      "Epoch 36/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 7809966.0000 - accuracy: 0.3600\n",
      "Epoch 37/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 8808073.0000 - accuracy: 0.3070\n",
      "Epoch 38/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 10561910.0000 - accuracy: 0.3210\n",
      "Epoch 39/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 11071658.0000 - accuracy: 0.2990\n",
      "Epoch 40/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 12676856.0000 - accuracy: 0.3450\n",
      "Epoch 41/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 15314305.0000 - accuracy: 0.3200\n",
      "Epoch 42/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 15296033.0000 - accuracy: 0.2970\n",
      "Epoch 43/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 18609602.0000 - accuracy: 0.3410\n",
      "Epoch 44/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 19076538.0000 - accuracy: 0.3390\n",
      "Epoch 45/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 22068894.0000 - accuracy: 0.3000\n",
      "Epoch 46/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 25399620.0000 - accuracy: 0.3200\n",
      "Epoch 47/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 26496258.0000 - accuracy: 0.3230\n",
      "Epoch 48/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 31318010.0000 - accuracy: 0.3170\n",
      "Epoch 49/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 30170452.0000 - accuracy: 0.3460\n",
      "Epoch 50/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 36672356.0000 - accuracy: 0.3360\n",
      "Epoch 51/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 39343264.0000 - accuracy: 0.3260\n",
      "Epoch 52/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 42800440.0000 - accuracy: 0.3300\n",
      "Epoch 53/60\n",
      "16/16 [==============================] - 0s 3ms/step - loss: 49218704.0000 - accuracy: 0.3390\n",
      "Epoch 54/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 51398884.0000 - accuracy: 0.3180\n",
      "Epoch 55/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 55705020.0000 - accuracy: 0.3290\n",
      "Epoch 56/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 61452760.0000 - accuracy: 0.3400\n",
      "Epoch 57/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 66218764.0000 - accuracy: 0.3310\n",
      "Epoch 58/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 76213616.0000 - accuracy: 0.3110\n",
      "Epoch 59/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 78654584.0000 - accuracy: 0.3250\n",
      "Epoch 60/60\n",
      "16/16 [==============================] - 0s 2ms/step - loss: 88180344.0000 - accuracy: 0.3600\n",
      "1/1 [==============================] - 0s 185ms/step - loss: 142440512.0000 - accuracy: 0.1500\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense, Dropout\n",
    "# 生成虚拟数据\n",
    "x_train = np.random.random((1000, 12))\n",
    "y_train = np.random.randint(2, size=(1000, 3))\n",
    "x_test = np.random.random((100, 12))\n",
    "y_test = np.random.randint(2, size=(100, 3))\n",
    "\n",
    "print(x_train)\n",
    "print(y_train)\n",
    "\n",
    "model.fit(x_train, y_train,\n",
    "          epochs=60,\n",
    "          batch_size=64)\n",
    "score = model.evaluate(x_test, y_test, batch_size=128)\n",
    "model.save('reskin.h5')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "magnn",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "138191362d8d8e7e4e1c7c37de97f18924d70dc77eb4390b004321d25d3fcdef"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
